package com.jack.leetcode.eachproblem_2020;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by zhang_j on 2020/11/6
 */
public class 根据数字二进制下一的数目排序 {


    public int[] sortByBits(int[] arr) {
        if(arr == null || arr.length == 0){
            return null;
        }
        for(int i = 0;i < arr.length;i++){
            arr[i] = Integer.bitCount(arr[i]) * 100_000 + arr[i];
        }
        Arrays.sort(arr);
        for(int i = 0;i < arr.length;i++){
            arr[i] %= 100_0000;
        }
        return arr;
    }



    public static void main(String[] args) {
        System.out.println(100_1000);
    }
}
